package org.crazyit.activiti_d5._3_Interceptor;

import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandConfig;
import org.activiti.engine.impl.interceptor.CommandInterceptor;

/**
 * 拦截器实现A
 */
public class InterceptorB implements CommandInterceptor {

    private CommandInterceptor next;

    public <T> T execute(CommandConfig commandConfig, Command<T> command) {

        //1. 输出字符串和命令
        System.out.println("this is interceptorB: " + command.getClass().getName());

        //2. 然后让责任链中的下一请求处理者处理命令
        return getNext().execute(commandConfig, command);

    }

    public CommandInterceptor getNext() {
        return this.next;
    }

    public void setNext(CommandInterceptor commandInterceptor) {
        this.next = commandInterceptor;
    }
}
